Imports System.Web.Services
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration

<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> Public Class YourWebService
    Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Web Services Designer.
        InitializeComponent()

        'Add your own initialization code after the InitializeComponent() call

    End Sub

    'Required by the Web Services Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Web Services Designer
    'It can be modified using the Web Services Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        'CODEGEN: This procedure is required by the Web Services Designer
        'Do not modify it using the code editor.
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

#End Region

    <WebMethod()> _
    Public Function AccessDataSet(ByVal strSQL As String) As DataSet
        Return getAccessDataSet(strSQL)
    End Function

    Function getAccessDataSet(ByVal strSQL As String) As DataSet
        Dim myDataSet As New DataSet()
        Try
            Dim strConn = "server=localhost;database=Northwind;UID=sa;PWD=aido;Connect Timeout=30"
            Dim myConn As SqlConnection = New SqlConnection(strConn)
            Dim myDataAdapter As New SqlDataAdapter(strSQL, myConn)
            myDataAdapter.Fill(myDataSet, strSQL)
        Catch objError As Exception

            Exit Function
        End Try
        Return myDataSet
    End Function

End Class
